import { get, post } from '@/utils/http'

enum API {
  // 操作记录
  OPERATIONLOG_API = '/operationLog/operationLog',
  // 获取操作记录列表
  OPERATIONLOGLIST_API = '/operationLog/operationLogList',
  // 根据账号搜索最近十条操作记录
  SEARCHOPERATIONLOGLIST_API = '/operationLog/searchoperationLogList',
  // 清空操作日志
  CLEAROPERATIONLOG_API = '/operationLog/clearoperationLog'
}
// 操作记录
export const operationLogAPI = (
  operation_person: string,
  operation_content: string,
  operation_level: string
) => {
  return post<void>(API.OPERATIONLOG_API, { operation_person, operation_content, operation_level })
}

// 获取操作记录列表
export const getoperationLogListAPI = (page: number) => {
  return get<operationLog[]>(API.OPERATIONLOGLIST_API, { params: { page } })
}

// 根据账号搜索最近十条操作记录
export const searchoperationLogListAPI = (page: number) => {
  return get<void>(API.SEARCHOPERATIONLOGLIST_API, { params: { page } })
}

// 清空操作日志
export const clearoperationLogAPI = () => {
  return post<void>(API.CLEAROPERATIONLOG_API)
}
